package com.example.asapp.user.role;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
@Slf4j
@RequestMapping("/api/user/role")
public class RoleApi {

    @Autowired
    RoleService roleService;

    @GetMapping("listQuery")
    public List<Role> findAll(){
        return roleService.findAll();
    }

    @PostMapping("save")
    public Role saveOne(@RequestBody Role role){
        return roleService.saveOne(role);
    }

    @DeleteMapping("delete/{id}")
    public void deleteOne(@PathVariable String id){
       roleService.deleteByPrimary(id);
    }



}
